<script>
	export default {
		onLaunch: function() {
			console.log('App Launch')
			uni.hideTabBar()
			//console.log('App Launch')
			var that = this;
			/**
			 * 判断小程序应用更新
			 */
			// #ifdef MP-WEIXIN
			    that.app_update(); //小程序应用更新
			// #endif
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods:{
			/**
			 * 小程序应用更新
			 */
			app_update:function()
			{
				//console.log('小程序应用更新');
				if (uni.canIUse('getUpdateManager')) {
					const updateManager = uni.getUpdateManager();
					updateManager.onCheckForUpdate(function (res) {
						if (res.hasUpdate) {
							updateManager.onUpdateReady(function () {
								uni.showModal({
									title: '更新提示',
									content: '新版本已经准备好，是否重启应用？',
									success: function (res) {
										if (res.confirm) {
											updateManager.applyUpdate();
										}
									},
								});
							});
							updateManager.onUpdateFailed(function () {
								uni.showModal({
									title: '已经有新版本了哟~',
									content: '新版本已经上线啦~，请您删除当前小程序，重新搜索打开哟~',
								});
							});
						}
					});
				} else {
					uni.showModal({
						title: '提示',
						content: '当前微信版本过低，无法使用该功能，请升级到最新微信版本后重试。',
					});
				}
			},
			onShareAppMessage: function (options) {//分享
			    return {
			        title: this.data.pageData.name,
			        path: `packageA/pages/bossDet/bossDet?id=${this.data.id}`,
			        success: function (res) {
			            console.log(res,'成功')
			            console.info(res + '成功');
			            wx.showToast({
			                title: '分享成功',
			            })
			            // 转发成功
			        },
			        fail: function (res) {
			            console.log(res + '失败');
			            // 转发失败
			        },
			        complete: function (res) {
			            // 不管成功失败都会执行
			            console.log(res,'成功或失败')
			            wx.showToast({
			                title: '成功或失败',
			            })
			        }
			    }
			 },
		}
	}
</script>

<style>
  page{
    height: 100%;
  }
	/*每个页面公共css */
	@font-face {
	  font-family: 'iconfont';  /* project id 1488403 */
	  src: url('//at.alicdn.com/t/font_1488403_6jvjdwpn319.eot');
	  src: url('//at.alicdn.com/t/font_1488403_6jvjdwpn319.eot?#iefix') format('embedded-opentype'),
	  url('//at.alicdn.com/t/font_1488403_6jvjdwpn319.woff2') format('woff2'),
	  url('//at.alicdn.com/t/font_1488403_6jvjdwpn319.woff') format('woff'),
	  url('//at.alicdn.com/t/font_1488403_6jvjdwpn319.ttf') format('truetype'),
	  url('//at.alicdn.com/t/font_1488403_6jvjdwpn319.svg#iconfont') format('svg');
	}
	uni-button:after{
		border: none;
	}
	.green {
		color: #32c45e;
	}
	.yellow {
		color: #f8d448;
	}
	.blue {
		color: #227aff;
	}
	.orange {
		color: #ed965f;
	}
	.gray{
		color: #979797;
	}
	.input-placeholder{
		font-size: 26upx;
	}
  input {
    font-size: 26upx;
  }
	.icon {
	  font-size: 32upx;
	  font-family: iconfont;
	}
</style>
